﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="addnews.aspx.cs" Inherits="Forum.Web.Admin.Company.news.addnews" %>

<%@ Register Assembly="Editor2" Namespace="Editor2" TagPrefix="cc1" %>
<%@ Register Assembly="Public.Control" Namespace="Public.Control" TagPrefix="cc11" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link href="../../styles/dntmanager.css" rel="stylesheet" type="text/css" />
    <link href="../../styles/modelpopup.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .list_tu
        {
            height: 120px;
            width: 120px;
            float: left;
            display: block;
            margin-right: 15px;
            margin-top: 15px;
            border: 1px solid #729FD8;
        }
        .apDiv1
        {
            position: static;
            height: 20px;
            z-index: 1;
            margin-top: -20px;
        }
        .apDiv1 div
        {
            background-color: #B3CBEA;
            height: 20px;
            text-align: center;
            line-height: 20px;
            cursor: pointer;
            float: left;
            width: 120px;
        }
        #jiatu_
        {
            float: left;
            margin-top: 15px;
            padding-top: 60px;
        }
        #jiatu_ img
        {
            cursor: pointer;
        }
        .list_tu img
        {
            height: 100px;
            width: 120px;
        }
        .list_tu div
        {
            background-color: #FFFFFF;
            line-height: 20px;
            height: 20px;
            width: 120px;
        }
        .list_tu span
        {
            cursor: pointer;
        }
        .list_tu span:hover
        {
            color: #FF0000;
        }
    </style>
</head>
<script src="../../js/common.js" type="text/javascript"></script>
<script src="../../js/modalpopup.js" type="text/javascript"></script>
<body class="ContentBody">
    <form id="form2" runat="server">
    <asp:TextBox ID="TextBox1" runat="server" Width="672px" Style="display: none;"></asp:TextBox>
    <cc11:Hint ID="Hint1" runat="server" HintImageUrl="../../images" />
    <div class="ManagerForm">
        <fieldset>
            <legend style="background: url(../../images/icons/icon30.jpg) no-repeat 6px 50%;">添加/修改新闻</legend>
            <div class="MainDiv">
                <table width="100%" border="0" cellpadding="0" cellspacing="0" style="width: 100%;
                    padding-right: 5px;">
                    <tr>
                        <td height="40" align="right" style="padding-right: 5px">
                            标题:
                        </td>
                        <td>
                            &nbsp;&nbsp;<cc11:TextBox ID="f_name" HintInfo="英文汉字均可,不能为空" runat="server" Width="210px"></cc11:TextBox>
                            <span style="display: none;">
                                <input id="Text2" style="width: 12px" type="text" /></span>
                        </td>
                    </tr>
                    <tr>
                        <td width="100" height="40" align="right" style="padding-right: 5px; width: 100px">
                            标题显示颜色:
                        </td>
                        <td>
                            &nbsp;
                            <select id="f_color" runat="server">
                                <option value="">请选择颜色</option>
                                <option style="background-color: #FF0000; color: #FF0000" value='#FF0000'>#FF0000</option>
                                <option style="background-color: #0000FF; color: #0000FF" value="#0000FF">#0000FF</option>
                                <option style="background-color: #008800; color: #008800" value="#008800">#008800</option>
                                <option style="background-color: #FFFF00; color: #FFFF00" value="#FFFF00">#FFFF00</option>
                                <option style="background-color: #9900FF; color: #9900FF" value="#9900FF">#9900FF</option>
                                <option style="background-color: #808080; color: #808080" value="#808080">#808080</option>
                                <option style="background-color: #00FFFF; color: #00FFFF" value="#00FFFF">#00FFFF</option>
                                <option style="background-color: #998566; color: #998566" value="#998566">#998566</option>
                                <option style="background-color: #FFCC00; color: #FFCC00" value="#FFCC00">#FFCC00</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td height="40" align="right">
                            描述:
                        </td>
                        <td height="50" style="padding: 5px">
                            <cc11:TextBox ID="f_shuoming" HintInfo="对主内容的简短说明,120个汉字以内" runat="server" Width="400px"
                                Height="80px" TextMode="MultiLine"></cc11:TextBox>
                        </td>
                    </tr>
                    <tr id="yc_0">
                        <td height="40" align="right">
                            内容:
                        </td>
                        <td height="50" style="padding: 5px">
                            <cc1:HtmlEditor ID="HtmlEditor1" runat="server" Width="600px" ResourcesPath="/htmledit/">
                            </cc1:HtmlEditor>
                        </td>
                    </tr>
<tr>
                        <td height="40" align="right" style="padding-right: 5px">
                            发布时间:
                        </td>
                        <td>
                            &nbsp;&nbsp;<cc11:TextBox ID="f_addtime"  runat="server" Width="210px"></cc11:TextBox>
                        &nbsp;(如:2010-12-02)</td>
                    </tr>
                    <tr>
                        <td height="40" align="right">
                            首页缩略图:
                        </td>
                        <td height="50">
                            &nbsp;
                            <cc11:TextBox ID="f_tu" HintInfo="可为网络地址,如:http://www.jingdiansheji.com/logo.gif"
                                runat="server" Width="220" HintShowType="up"></cc11:TextBox>
                            <cc11:Button ID="Button3" runat="server" AutoPostBack="False" ButtonImgUrl="../../images/arrow_undo.gif"
                                Text=" 浏 览" ValidateForm="False" ScriptContent="tu_()" />&nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td height="40" align="right">
                            点击:
                        </td>
                        <td height="50">
                            &nbsp; 初始点击:
                            <cc11:TextBox ID="f_fangwen" runat="server" Width="60" Text="0"></cc11:TextBox>
                            &nbsp;
                        </td>
                    </tr>
                    <tr id="z_fl">
                        <td height="40" align="right">
                            其它选项:
                        </td>
                        <td height="50">
                            &nbsp;
                            <input id="f_shenhe" type="checkbox" runat="server" /><label for="f_shenhe">立即发布</label><span
                                style="color: Red;">（否则审核后才能显示在前台页面上）</span>
                        </td>
                    </tr>
                </table>
                <script src="../../js/jquery/jquery.js" type="text/javascript"></script>
                <script type="text/javascript">
var id=<%=id %>;



function onsub_()
{
    var f_bt=$("#f_name");
    var f_ys=$("#f_color");
    var f_sm=$("#f_shuoming");
    var rbody=RIfrBodyHtml();
    var f_tu=$("#f_tu");
    var f_fwl=$("#f_fangwen");
    var f_sh=$("#f_shenhe");
    var f_addtime=$("#f_addtime");

    if($.trim(f_bt.val())=="")
    {
        alert("标题不能为空");
        f_bt.focus();
        return;
    }

    oRTE = frames.message;
    if($.trim(rbody)=="")
    {
        alert("内容不能为空");
        oRTE.focus();
        return;
    }

    if($.trim(f_addtime.val())=="")
    {
        alert("添加时间不能为空");
        f_addtime.focus();
        return;
    }

     Forum.Web.Admin.Company.news.addnews.AddData(id, f_bt.val(), f_ys.val(), f_tu.val(), f_fwl.val(), (f_sh.attr("checked")?1:0), f_sm.val(), rbody,f_addtime.val(), function (res){
        if(res!=null && res.value!="0")
        {
            if(id!=0)
            {
                alert("更新成功");
            }
            else
            {
                var msg=confirm("添加成功,是否继续添加");
                if(msg)
                {
                    window.location.reload();
                }
                else{
                    window.location="list.aspx";
                }
            }
        }
     });

}

function up1_onclick() {
   tu_();
}
function tu_() {
    var v1=$('#f_tu');
	var galleryscript = '../../IfrUpAspx/Ifr.aspx?url=UpPic.aspx?path=DownLoad/&yymmdd=false';

	imgArr = showModalDialog(galleryscript,window,'dialogWidth:350px; dialogHeight:180px;help: no; scroll: no; status: no');
	if (imgArr != null) {
		v1.val(imgArr);
	}
}

$(function(){
    $("#Button4").click(function(){
        onsub_();
    });
});

                </script>
                <script type="text/javascript">
                    function addimg() {
                        var galleryscript = '../../IfrUpAspx/Ifr.aspx?url=UpPic.aspx?tf_xiaotu=true&path=DownLoad/&yymmdd=false';
                        imgArr = showModalDialog(galleryscript, window, 'dialogWidth:350px; dialogHeight:180px;help: no; scroll: no; status: no');
                        if (imgArr != null) {
                            AddImg(imgArr);
                            addhtml(imgArr);
                        }
                    }

                    var thisurl = window.location.toString().toLowerCase().replace("<%=thisurl %>".toLowerCase(), "");
                    function addimgs() {
                        var galleryscript = '../../IfrUpAspx/Ifr.aspx?url=UpPic.aspx?tf_xiaotu=true&path=DownLoad/&yymmdd=false';
                        imgArr = showModalDialog(galleryscript, window, 'dialogWidth:350px; dialogHeight:180px;help: no; scroll: no; status: no');
                        if (imgArr != null) {
                            var oRTE = frames.message;
                            try {
                                oRTE.focus();
                                var oRng = oRTE.document.selection.createRange();
                                if (imgArr.indexOf('http://') == -1) {
                                    oRng.pasteHTML("<img src='" + thisurl + "/" + imgArr + "'/>");
                                }
                                else {
                                    oRng.pasteHTML("<img src='" + imgArr + "'/>");
                                }
                                oRng.collapse(false);
                                oRng.select();
                            }
                            catch (e) { }
                        }
                    }
                </script>
            </div>
        </fieldset>
        <div class="Navbutton">
            <span id='sp3'>
                <cc11:Button ID="Button4" runat="server" AutoPostBack="False" ButtonImgUrl="../../images/check_1.gif"
                    Text=" 保存内容" ValidateForm="False" /></span> <span id='sp4' style="display: none;">
                        <cc11:Button ID="Button5" runat="server" AutoPostBack="False" ButtonImgUrl="../../images/check_1.gif"
                            Text=" 保存内容" ValidateForm="False" ScriptContent="return Button2_onclick()" />
                    </span><span id='sp5'>&nbsp;
                        <cc11:Button ID="Button6" runat="server" AutoPostBack="False" ButtonImgUrl="../../images/cache_reset.gif"
                            Text=" 取  消" ValidateForm="False" ScriptContent="history.go(-1);" /></span>
        </div>
    </div>
    </form>
</body>
</html>
